#include <iostream>
#include <cstring>

// 函数模板特化
template <typename T>
int compare(const T left, const T right)
{
    return (left - right);
}

template <>
int compare<const char *>(const char *left, const char *right)
{
    return strcmp(left, right);
}

// 类模板全特化
template <typename T>
class Compare
{
public:
    bool isEqual(T left, T right)
    {
        return left == right;
    }
};

template <>
class Compare<float>
{
public:
    bool isEqual(float left, float right)
    {
        return left == right;
    }
};

// 模板偏特化
template <typename T1, typename T2>
class Example
{
private:
    T1 _left;
    T2 _right;

public:
    Example(T left, T right) : _left(left), _right(right) {}
};

template <typename T>
class Example<char, T>
{
private:
    char _left;
    T _right;

public:
    Example(char left, T right) : _left(left), _right(right) {}
};
